The present invention relates to a printer for executing print processing according to print data input from a host computer such as a personal computer and in particular to a printer to which print data is input from the host computer in synchronization with a synchronizing signal output from the printer to the host computer.
Some printers for executing print processing based on print data transmitted from a host computer adopt a two-way synchronous serial interface system wherein the printer supplies a synchronizing signal to the host computer and receives print data synchronized with the synchronizing signal from the host computer. The printer adopting such an interface system receives print data transmitted by a host computer at the same timing as a synchronizing signal supplied to the host computer, thereby performing print processing.
A first conventional printer adopting such an interface system samples print data transmitted by a host computer at the same timing as a synchronizing signal supplied to the host computer, thereby detecting print data. Specifically, the printer samples and detects a start bit placed at the top of data on the rising or falling edge of a synchronizing signal, thereby determining print data.
However, the first conventional printer cannot correctly detect print data if the channel between the printer and the host computer, for example, the length of a printer cable changes or the transmission speed becomes higher than the initial speed. Therefore, the first conventional printer may become unable to execute required print processing. That is, a delay on a channel such as the printer cable between the printer and the host computer or a transmission circuit of the host computer may cause the rising or falling timing of a synchronizing signal when the printer samples print data to differ from the rising or falling timing of a print data signal from the host computer. If the data transmission speed becomes high and the synchronizing signal frequency also becomes high, effect of the difference on the synchronizing signal width becomes larger relatively, thus the printer cannot detect a start bit in the print data.
A second conventional printer is a printer in a system wherein a host computer is connected to another computer and peripheral machines, for example, by a LAN (local area network). In the system, when the host computer outputs print data to the printer, it may change the data transmission speed to the printer because the host computer needs to perform any other processing at the same time.
In such a case, normally the host computer sends a change command for changing the clock rate of a synchronizing signal to the printer as data and the printer receiving the command changes the synchronizing signal to the corresponding clock rate.
However, generally the second conventional printer is adapted to once store the data transmitted from the host computer in a reception buffer memory and read the stored data in sequence for processing. Thus, if a data transmission speed change command as described above is transmitted, the change command is processed after the previously stored data is processed. Meanwhile, the host computer needs to stop transmitting data and stand by for a given time after transmitting the change command.
That is, a temporary wait occurs in the host computer because the host computer cannot send subsequent data until it becomes possible for the printer to receive data at new setup data transmission speed or until reception of a speed change complete notification from the printer. In this case, the host computer needs to be provided with a protocol for performing wait processing and the printer needs to be provided with a protocol for returning a speed change complete notification.
If the host computer is adapted to send data after the change command, the printer needs to be provided with a circuit capable of reliably receiving data after the data transmission speed is changed and the host computer needs also to be provided with a circuit capable of reliably transmitting data in such a case.
A third conventional printer is a printer for transmitting a status signal of a notifying a current state of the printer, such as printing, print completion, or no paper, to a host computer as required. In this case, the host computer notifies the host computer user of the current state of the printer. To communicate data between the printer and the host computer based on a synchronizing signal transmitted from the printer to the host computer as described above, a kind of the status signal is transmitted from the printer to the host computer in synchronization with the synchronizing signal.
Here, for example, if the host computer has a low data reception capability, namely, has a small input buffer or a low reception data processing capability, there is a fear of occurrence of incomplete or missing data in the host computer. In such a case, the third conventional printer adopts a technique of setting the transmission speed of data transferred between the host computer and the printer to low speed to such a degree that the host computer can process data.
The host computer transmits a data transmission speed change command to the printer, requesting the printer to lower the data transmission speed of the synchronizing signal output from the printer to such a degree that the host computer can process data, thereby temporarily changing the data transmission speed of the synchronizing signal output from the printer. In this case, the host computer receives a synchronizing signal at new setup data transmission speed from the printer, prepares for data reception at the speed, and upon completion of the preparation, transmits a completion signal (for example, Ready signal) to the printer, then receives data from the printer. After receiving the data from the printer, the host computer performs similar processing to change the data transmission speed to the former speed.
To perform data transmission speed change processing as described above, the host computer is provided with a protocol for performing such control and sends a predetermined command to the printer based on the protocol and a protocol corresponding thereto is also set in the printer.
However, in the third conventional printer, if the data transmission speed between the host computer and the printer is set low, as the data transmission speed from the host computer to the printer lowers, the time required for transmitting print data from the host computer is prolonged and it takes time until completion of print processing. To temporarily change the data transmission speed, the third conventional printer needs to perform complicated processing as described above; control becomes complicated and it takes extra time to execute processing.
A fourth conventional printer is a printer By the way, in a conventional printer transferring data from a data reception section in an interface control section to an input buffer in a print processing execution section by starting DMA (direct memory access) or using a general-purpose interrupt processing (data transfer by software) when data is received from the host. In the printer, often the input buffer in the print processing execution section is made of a so-called ring buffer. In such a case, for example, to execute DMA transfer of data from the data reception section to the input buffer (ring buffer), the counter value set in DMA becomes such as the empty area size to the termination address (the number of addresses) even if so-called link processing is performed. At the time of DMA termination, it becomes necessary to perform processing of returning the pointer to the top of the empty area in the ring buffer and resetting the counter. To transfer data from the data reception section to the input buffer (ring buffer) by the above-described general-purpose interrupt processing (data transfer by software), ring buffer processing is also required.
The data transfer rate (baud rate) in the serial communication system between a host and a printer keeps on speeding up year by year like 900 Kbps to 1.8 Mbps to 3.6 Mbps. If the processing for the data transfer termination (ring buffer processing) described above is late by the time the data reception section in the interface control section receives another data piece after one data piece is received at the data reception section and is transferred to the input buffer in the print processing execution section, an overrun error occurs and it is feared that the data in the data reception section may be lost. For example, if one byte of print data in a raster format is lost, print is simply placed out of order or the like, but if data containing control data is lost, a great deal of data may become missing.
In the two-way serial communication system between a host and a printer, the printer can inform the host of a BUSY state so that the host stops data transfer. However, if the host is informed of the BUSY state, generally it cannot immediately stop the data transfer. Thus, it is impossible to completely prevent an overrun error from occurring simply by informing the host of the BUSY state.
For example, assuming that data is transferred at a baud rate of 1.8 Mbps, 1-byte data is sent once about 5 μs from the host. In the case of the data processing speed of the printer is slow, even if DMA transfer of data is executed from the data reception section to the input buffer (ring buffer), it is feared that the processing at the DMA transfer termination time described above may be late by the time the data reception section in the interface control section receives another data piece after one data piece is received at the data reception section and is DMA-transferred to the input buffer in the print processing execution section.